Summary of the Translation Manager
This section provides Pascal, C, and assembly-language summaries for the constants, data types, and routines provided by the Translation Manager for use by applications. For a summary of the constants, data types, and routines that you can use or need to define if you're writing a translation extension, see "Summary of Translation Extensions" beginning on page 7-68.
Pascal Summary
Constants
CONST
{Gestalt selectors and response bit numbers}
gestaltTranslationAttr = 'xlat'; {Translation Manager}
gestaltTranslationMgrExists = 0; {TM is present}
gestaltStandardFileAttr = 'stdf'; {Standard File Package}
gestaltStandardFile58 = 0;
gestaltStandardFileTranslationAware = 1;
gestaltStandardFileHasColorIcons = 2;
gestaltEditionMgrAttr = 'edtn'; {Edition Manager}
gestaltEditionMgrPresent = 0;
gestaltEditionMgrTranslationAware = 1;
gestaltScrapMgrAttr = 'scra'; {Scrap Manager}
gestaltScrapMgrTranslationAware = 0;
Data Types
TYPE
FileType = OSType; {file types}
ScrapType = ResType; {scrap types}
FileTypePtr = ^FileType;
FileTranslationSpec = ARRAY[1..12] OF LongInt;
TypesBlock = ARRAY[0..63] OF FileType;
TypesBlockPtr = ^TypesBlock;
DocOpenMethod = (domCannot,
domNative,
domTranslateFirst,
domWildcard);
Translation Manager Routines
Getting Translation Information
FUNCTION GetFileTypesThatAppCanNativelyOpen
(appVRefNumHint: Integer; appSignature: OSType;
VAR nativeTypes: TypesBlock): OSErr;
FUNCTION ExtendFileTypeList
(originalTypeList: FileTypePtr;
numberOriginalTypes: Integer;
extendedTypeList: FileTypePtr;
VAR numberExtendedTypes: Integer): OSErr;
FUNCTION CanDocBeOpened (targetDocument: FSSpec;
appVRefNumHint: Integer;
appSignature: OSType;
nativeTypes: TypesBlockPtr;
onlyNative: Boolean;
VAR howToOpen: DocOpenMethod;
VAR howToTranslate: FileTranslationSpec)
: OSErr;
Translating Files
FUNCTION TranslateFile (sourceDocument: FSSpec;
destinationDocument: FSSpec;
howToTranslate: FileTranslationSpec): OSErr;
C Summary
Constants
/*Gestalt selectors and response bit numbers*/
enum {
#define gestaltTranslationAttr 'xlat' /*Translation Manager*/
gestaltTranslationMgrExists = 0 /*TM is present*/
};
enum {
#define gestaltStandardFileAttr 'stdf' /*Std File Package*/
gestaltStandardFile58 = 0,
gestaltStandardFileTranslationAware = 1,
gestaltStandardFileHasColorIcons = 2
};
enum {
#define gestaltEditionMgrAttr 'edtn' /*Edition Manager*/
gestaltEditionMgrPresent = 0,
gestaltEditionMgrTranslationAware = 1
};
enum {
#define gestaltScrapMgrAttr 'scra' /*Scrap Manager*/
gestaltScrapMgrTranslationAware = 0
};
enum {domCannot, domNative, domTranslateFirst, domWildcard};
Data Types
typedef OSType FileType; /*file types*/
typedef ResType ScrapType; /*scrap types*/
typedef long FileTranslationSpec[12];
typedef short DocOpenMethod;
Translation Manager Routines
Getting Translation Information
pascal OSErr GetFileTypesThatAppCanNativelyOpen
(short appVRefNumHint, OSType appSignature,
FileType* nativeTypes);
pascal OSErr ExtendFileTypeList
(const FileType* originalTypeList,
short numberOriginalTypes,
FileType* extendedTypeList,
short* numberExtendedTypes);
pascal OSErr CanDocBeOpened
(const FSSpec* targetDocument,
short appVRefNumHint,
OSType appSignature,
const FileType* nativeTypes,
Boolean onlyNative,
DocOpenMethod* howToOpen,
FileTranslationSpec* howToTranslate);
Translating Files
pascal OSErr TranslateFile (const FSSpec* sourceDocument,
const FSSpec* destinationDocument,
const FileTranslationSpec* howToTranslate);
Assembly-Language Summary
Data Structures
File Translation Specification
| 0 | data | 48 bytes | private data used by the Translation Manager |
Trap Macros
Trap Macros Requiring Routine Selectors
_TranslationDispatch
| Selector | Routine |
|---|
| $0009 | ExtendFileTypeList |
| $000C | TranslateFile |
| $001C | GetFileTypesThatAppCanNativelyOpen |
| $001E | CanDocBeOpened |
Result Codes
| noErr | 0 | No error |
| dirFulErr | -33 | Directory full |
| dskFulErr | -34 | Not enough disk space to translate file |
| nsvErr | -35 | No such volume |
| ioErr | -36 | I/O error |
| bdNamErr | -37 | Bad filename |
| tmfoErr | -42 | Too many files open |
| fnfErr | -43 | File not found |
| wPrErr | -44 | Disk is write protected |
| fLckdErr | -45 | File is locked |
| vLckdErr | -46 | Volume is locked |
| dupFNErr | -48 | Duplicate filename (rename) |
| opWrErr | -49 | File already open with write permission |
| paramErr | -50 | Parameter error |
| extFSErr | -58 | External file system |
| noTypeErr | -102 | Unrecognized file type |
| memFullErr | -108 | Not enough RAM to translate file |
| dirNFErr | -120 | Directory not found or incomplete pathname |
| wrgVolTypErr | -123 | Volume does not support Desktop Manager |
| userCanceledErr | -128 | The user canceled the translation |
| invalidTranslationPathErr | -3025 | howToTranslate is invalid |
| noTransSysInstalledErr | -3027 | No translation systems installed |
| noTranslationPathErr | -3030 | Application cannot open document |
| badTranslationSpecErr | -3031 | Translation path is invalid |
| noPrefAppErr | -3032 | No translation preference available |
| afpItemNotFound | -5012 | Could not determine kind string; or, application information not found |